<?php
class connectDB
{
	var $username = 'root';
	var $password = 'vertrigo'; 
	var $location = 'localhost' ;
	var $db = 'CV';
	var $connect;
	var $table;
	
	function connectDB()
	{
		$this->connect = mysql_connect($this->location, $this->username, $this->password) or die ("Could not connect to database");
		$this->table = mysql_select_db($this->db, $this->connect) or die ("could not select database");
		return true;
	}
	
	function switchDB($uname, $passwd, $loc, $dbNaam)
	{
		$close = mysql_close($this->connect);
		$this->connect = mysql_connect($location, $username, $password) or die ("Could not connect to database");
		if($this->switchTable($dbNaam) == true)
		{	return true;	}
	}
	function switchTable($dbNaam)
	{
		$this->table = mysql_select_db($dbNaam, $this->connect);
		return true;
	}
	
	function checkUser($username)
	{
		$mysql = "SELECT * FROM user WHERE user = '" . $username . "'";
		if ($query = mysql_query($mysql) !== null)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	function checkPassword($pass)
	{
		$mysql = "SELECT * FROM user WHERE password = '" . $password . "'";
		if ($query = mysql_query($mysql))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
?>